package com.sz.sidi.exceptions;
/** 
 * @author DT E-mail: dengtao@chinacpby.com
 * @version ����ʱ�䣺Jun 5, 2009 5:54:16 PM  
 */
public class BusinessException extends Exception{
	/**
	 * default serial version ID
	 */
	private static final long serialVersionUID = 1L;
	protected Throwable throwable;
	
	/**
	 * 异常代码，1：错误
	 */
	public static final int ERROR=1;	//1：错误
	
	/**
	 * 异常代码，2：警告
	 */
	public static final int WARNING=2;	//2：警告
	
	/**
	 * 异常代码，3：提示
	 */
	public static final int INFO=3;		//3：提示
	
	private int errcode=ERROR;

	/**
	 * Method 'BusinessException'
	 * 
	 * @param message
	 */
	public BusinessException(String message)
	{
		super(message);
		this.throwable=new Throwable(message);
	}
	
	/**
	 * @param message 异常消息
	 * @param errcode 异常代码，1：错误（默认），2：警告，3：提示
	 */
	public BusinessException(String message,int errcode)
	{
		super(message);
		this.throwable=new Throwable(message);
		this.errcode=errcode;
	}

	/**
	 * Method 'BusinessException'
	 * 
	 * @param message
	 * @param throwable
	 */
	public BusinessException(String message, Throwable throwable)
	{
		super(message);
		this.throwable = throwable;
	}

	/**
	 * Method 'getCause'
	 * 
	 * @return Throwable
	 */
	@Override
	public Throwable getCause()
	{
		return throwable;
	}
	
	/**
	 * 返回异常代码，1：错误（默认），2：警告，3：提示
	 * @return
	 */
	public int getErrcode() {
		return errcode;
	}
}

